import service from "../uitils/request"

export const execQueryApi = (instanceId, sql, pageNo, pageSize) => {
    return service({
        url: "database/execQuery",
        method: 'POST',
        data: {
            instanceId: instanceId,
            sql: sql,
            pageNo: pageNo,
            pageSize: pageSize,
        }
    })
}

export const sqlTaskPageApi = (params) => {
    return service({
        url: "sqlTask/page",
        method: 'GET',
        params
    })
}

export const getTaskApi = (taskId) => {
    return service({
        url: `sqlTask/${taskId}`,
        method: 'GET',
    })
}

export const execTaskApi = (taskId) => {
    return service({
        url: `sqlTask/exec/${taskId}`,
        method: 'PUT',
    })
}

export const checkSqlApi = (data) => {
    return service({
        url: "sqlTask/checkSql",
        method: 'PUT',
        data
    })
}

export const execTestApi = (data) => {
    return service({
        url: "database/test",
        method: 'POST',
        data
    })
}